import {createSlice} from "@reduxjs/toolkit";


const counterStoreSlice = createSlice({
    name:"counter",
    initialState:{
        counter:100
    },
    reducers:{
        addNum(state,action){
            state.counter = state.counter + action.payload
        },
        subNum(state,action){
            state.counter = state.counter - action.payload
        }
    }
})


export const {addNum,subNum} = counterStoreSlice.actions


export default counterStoreSlice.reducer


